package com.itheima.server.controller;

import com.itheima.server.service.TanhuaService;
import com.itheima.tanhua.model.domain.PageResult;
import com.itheima.tanhua.model.dto.RecommendUserDto;
import com.itheima.tanhua.model.mongo.TodayBest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/tanhua")
public class TanhuaController {

    @Autowired
    private TanhuaService tanhuaService;

    /**
     * 今日佳人
     * @return
     */
    @GetMapping("/todayBest")
    public ResponseEntity todayBest(){

        TodayBest todayBest = tanhuaService.todayBest();
        return ResponseEntity.ok(todayBest);
    }

    /**
     * 分页查询推荐好友列表
     * @param recommendUserDto
     * @return
     */
    @GetMapping("/recommendation")
    public ResponseEntity recommendation(RecommendUserDto recommendUserDto){

       PageResult pageResult = tanhuaService.recommendation(recommendUserDto);

        return ResponseEntity.ok(pageResult);
    }
}
